'''该模板被导入时会执行。多次导入时执行一次。并且模块代码里的所有变量会共享'''

import os
import pygame as pg
from . import constants as c
from . import tools


# Initialize pygame
pg.init()

# Set allowed events for the game
pg.event.set_allowed([pg.KEYDOWN, pg.KEYUP, pg.QUIT])

# Set the caption for the game window
pg.display.set_caption(c.ORIGINAL_CAPTION)

# Create the game window/screen
SCREEN = pg.display.set_mode(c.SCREEN_SIZE)

# Get the rectangle representing the dimensions of the game window
SCREEN_RECT = SCREEN.get_rect()

# Load all the graphics from the specified directory
GFX = tools.load_all_gfx(os.path.join("resources", "graphics"))
